POV-Ray : Newsgroups : povray.general : Projecting a photograph on to a 3D model : Re: Projecting a photograph on to a 3D model Server Time
31 Jul 2024 02:32:00 EDT (-0400)
  Re: Projecting a photograph on to a 3D model  
From: Chris B
Date: 6 Dec 2007 06:08:58
Message: <4757d84a$1@news.povray.org>
"Tim Attwood" <tim### [at] comcastnet> wrote in message 
news:475758be@news.povray.org...
>> I have a photograph of a city taken from a plane showing the sides of 
>> buildings. I'd like to project the photo on to my 3D model of the city.
>
> In general, no, there are issues involving perspective,
> image location, and differences in apparent size versus actual size.
>
> But you can perspective correct portions of an image and then use
> those to map things like building faces, individually. It's just a lot of
> work.
>

Hi Mark,

There is a simple (albeit very crude) way to correct the proportions of the 
image. You can set up a 'projector' using a light source and a filtered 
image. As Trevor mentioned, you'd need the 3D model to fairly accurately 
represent the building shapes and you'll probably still get leaching around 
the edges, so I'm not claiming that this will be anywhere near perfect (just 
fairly quick to do).

Blocks representing the buildings should be white.

A single light source should be located roughly where your camera was 
relative to the city and the image should be placed a little way in front of 
it, oriented so that it's perpendicular to the line between the light and 
the centre of the image. Use 'filter all 1' to get the light to project the 
image. The building surfaces visible in the image will be illuminated with 
the appropriate image, surfaces hidden from your camera will remain white.

If you have more than one image you can have more than one projector, so, if 
your plane flew around the city and you got 4 photos, you might get a fairly 
complete coverage, although it may take a bit of fiddling around to align 
them correctly.

Here's a very simple example that projects an image onto a box and a 
cylinder.

camera {location <-0.74, 0.65, -3> look_at 0}
box {0,1 pigment {rgb 1}}
cylinder {0,y,0.4 pigment {rgb 1} translate -x}

light_source {<0,0,-400> color rgb 1}
plane {z,-300
  pigment {
    image_map {jpeg "Your_Image.jpg"
      filter all 1 once}
    translate <-0.5,-0.5,0>
  }
}

Hope this helps,

Regards,
Chris B.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.